-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ce/connect messaging #35364
base: master
Are you sure you want to change the base?
Ce/connect messaging #35364
Conversation
6a953fa
to
f22c90d
Compare
f22c90d
to
460c794
Compare
corehq/apps/sms/migrations/0061_connectmessage_message_id_connectmessage_received_on.py
Outdated
Show resolved
Hide resolved
@@ -1757,6 +1770,10 @@ def create_form_helper(): | |||
def form_choices(self): | |||
return [(form['code'], form['name']) for form in get_form_list(self.domain)] | |||
|
|||
@property | |||
def can_use_connect(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: is this better than just having the calling code check the feature flag?
@@ -405,3 +407,19 @@ def user_can_access_domain_specific_pages(request): | |||
return False | |||
|
|||
return couch_user.is_member_of(project) or (couch_user.is_superuser and not project.restrict_superusers) | |||
|
|||
|
|||
def connectid_token_auth(view_func): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's weird that connectid is one word. I do see that it's consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think of connectid
as its own thing (its a separate repo and site than connect), using one word feels like it implies that, rather than the id for connect, but I am not wedded to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
connectid
and "the id for connect` being two separate concepts sounds confusing, but I don't think I have enough context on the project to be certain or to make a better suggestion.
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name='connectmessagesurveycontent', | ||
name='form_unique_id', | ||
field=models.CharField(default=1, max_length=126), | ||
field=models.CharField(default="1", max_length=126), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just allow this to be blank? Or does 1 have a meaning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, this will be unnecessary once we combine the migrations as you mentioned above, we just needed any value to have a valid migration, even though that table was empty when I made this one, so it is never used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general this looks good to me but I'm not able to fully review all the implications of the changes.
corehq/apps/smsforms/tasks.py
Outdated
@@ -76,8 +76,8 @@ def send_first_message(domain, recipient, phone_entry_or_number, session, respon | |||
messaging_subevent_id=logged_subevent.pk | |||
) | |||
|
|||
if isinstance(phone_entry_or_number, PhoneNumber): | |||
send_sms_to_verified_number( | |||
if isinstance(phone_entry_or_number, PhoneNumber) or isinstance(phone_entry_or_number, ConnectMessagingNumber): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this can be simplified as isinstance supports giving it an iterable of types to match.
if isinstance(phone_entry_or_number, PhoneNumber) or isinstance(phone_entry_or_number, ConnectMessagingNumber): | |
if isinstance(phone_entry_or_number, (PhoneNumber, ConnectMessagingNumber)): |
corehq/messaging/scheduling/forms.py
Outdated
@@ -1565,6 +1576,8 @@ def add_initial_for_content(self, initial): | |||
initial['content'] = self.CONTENT_SMS_CALLBACK | |||
elif isinstance(content, FCMNotificationContent): | |||
initial['content'] = self.CONTENT_FCM_NOTIFICATION | |||
elif isinstance(content, ConnectMessageContent): | |||
initial['conent'] = self.CONTENT_CONNECT_MESSAGE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo 😢
result |= set(content.message) | ||
elif isinstance(content, EmailContent): | ||
elif isinstance(content, (EmailContent)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the ()
braces around EmailContent required here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
corehq/apps/users/models.py
Outdated
|
||
class Meta: | ||
unique_together = ('domain', 'commcare_user') | ||
|
||
def get_or_create_key(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be nice as a property that would silently get or create the key.
Reviewed through the "update report" commit (c67ac9e) |
Test failure looks real. |
docker/hq-compose.yml
Outdated
@@ -76,7 +76,7 @@ services: | |||
interval: 10s | |||
retries: 10 | |||
volumes: | |||
- ${VOLUME_PREFIX}${BLANK_IF_TESTS-postgresql:}/var/lib/postgresql/data | |||
- ${VOLUME_PREFIX}${BLANK_IF_TESTS-postgresql:}/var/lib/postgresql14/data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accidental?
6870aee
to
7142730
Compare
Product Description
This adds connect messaging as a new message type in the messaging framework. It does not currently support form sessions although I will add those prior to merge. That said, I wanted to open this up to review now since it is quite large and touches a fair amount of complex code.
Technical Summary
Tech Spec: https://docs.google.com/document/d/1FgsXr0PLR7Btq2fOBeXIMs_OziBRsUsATgHgWna0h5M/edit?tab=t.0#heading=h.3rzu21agk2m3
Design Doc: https://docs.google.com/document/d/1h3bcZ4oQAnOu5aGW8Rue0TnbiaW2OXWMaqNKwI6RciE/edit?tab=t.0#heading=h.ipgou4bu0qoj
The linked docs provide much of the context
Feature Flag
COMMCARE_CONNECT for now, but I expect to migrate it to its own flag so that it can be enabled independently of the rest of the connect features.
Safety Assurance
Safety story
Existing messaging paths have automated coverage, and are only minimally modified. The new code is almost entirely self contained and will go through a QA process.
Automated test coverage
QA Plan
No QA ticket yet since it is not finished, but I will add it once it starts.
Migrations
Rollback instructions
Labels & Review